Skip to content

feat: print version and exit on --version#463

Merged
sirmalloc merged 1 commit into
sirmalloc:mainfrom
CorticalCode:feat/version-flag
Jun 19, 2026
Merged

feat: print version and exit on --version#463
sirmalloc merged 1 commit into
sirmalloc:mainfrom
CorticalCode:feat/version-flag

Conversation

@CorticalCode

Copy link
Copy Markdown
Contributor

Summary

ccstatusline --version currently launches the interactive TUI instead of reporting the version. The entry point only branches on --hook and then TTY-vs-piped mode, so an unrecognized flag falls through to the TUI. This adds a --version check at the top of main() that prints the version and exits, which is the expected behavior for a CLI/TUI.

Closes #461.

Approach

A single guard before mode detection in src/ccstatusline.ts, reusing the existing getPackageVersion() helper from src/utils/terminal.ts:

  • getPackageVersion() returns the build-substituted version and falls back to reading package.json, so --version is correct both from the published build and when run from source.
  • No new dependency, and it is consistent with the existing manual --config / --hook argument handling.

Test plan

  • bun run lint passes (tsc + eslint, --max-warnings=0).
  • --version prints the version and exits 0:
    • from source: bun run src/ccstatusline.ts --version -> 2.2.22
    • from the built artifact: node dist/ccstatusline.js --version -> 2.2.22
  • Piped status-line rendering is unchanged (the guard runs and returns before mode detection); the TUI still launches with no args.

Running ccstatusline --version launched the TUI instead of reporting the version. Handle the flag at the top of main() before mode detection: print getPackageVersion() and exit. Closes sirmalloc#461.
@sirmalloc sirmalloc merged commit 8398d91 into sirmalloc:main Jun 19, 2026
3 checks passed
@sirmalloc

Copy link
Copy Markdown
Owner

Thanks, it'll go out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ccstatusline --version should report version

2 participants